<template>
    <page-wrap>
        <div class="container">
            <div class="code-row">
                <div class="color-CCCCCC">{{route.query.consumeCode}}</div>
                <div class="color-FFAA00">已支付</div>
            </div>
            <div  v-for="(item,index) in wareList" :key="index">
            <div class="ware-box" v-if="index < 4" >  
                <img v-if="item.Attachment" class="img-ware" :src="item.Attachment" alt mode="multiply" />
                <img v-else class="img-ware" src="https://jtmc.oss-cn-hangzhou.aliyuncs.com/public/other/h5-default.png" alt /> 
                <div class="ware-info-box">
                    <div class="title-row">
                        <div v-if="item.SubGoods" class="ware-type packge">套餐</div>
                        <div v-else  class=" ware-type not-packge">单品</div>
                        <div  class="van-ellipsis ware-title">{{ item.GoodsName }}</div>
                    </div>
                    <div class="info">{{ item.Flavor }}</div>
                    <div class="price">
                        <span>￥{{ item.TotalAmt }}</span>
                        <!-- <span class="price-no">￥{{ item.TotalAmt }}</span> -->
                    </div>
                </div>  
            </div>
            <div class="ware-box" v-if="index >= 4 && moreFlag"> 
                <img v-if="item.Attachment" class="img-ware" :src="item.Attachment" alt />
                <img v-else class="img-ware" src="https://jtmc.oss-cn-hangzhou.aliyuncs.com/public/other/h5-default.png" alt />
                <div   class="ware-info-box">
                    <div class="title-row">
                        <div v-if="item.SubGoods" class="ware-type packge">套餐</div>
                        <div v-else class=" ware-type not-packge">单品</div>
                        <div class="van-ellipsis ware-title">{{ item.GoodsName }}</div>
                    </div>
                    <div class="info">{{ item.Flavor }}</div>
                    <div class="price">
                        <span>￥{{ item.TotalAmt }}</span>
                        <!-- <span class="price-no">￥{{ item.TotalAmt }}</span> -->
                    </div>
                </div> 
            </div>
        </div>
            <div class="more-row" @click="moreFlag = !moreFlag">
                <span>展开全部</span>
                <van-icon v-if="moreFlag" name="arrow-down" />
                <van-icon v-else name="arrow-up" />   
            </div>
        </div>
        <div class="foot-view">
            <div class="dashed-line"></div>
            <div class="h-20"></div>

            <div class="item-view">
                <div>下单时间</div>
                <div>{{ wareModal.OrderTime }}</div>
            </div>
            <div class="h-12"></div> 

            <div class="item-view">
                <div>订单金额</div>
                <div>{{ wareModal.TotalAmt }}</div>
            </div>
            <div class="h-12"></div> 

            <div class="item-view">
                <div>优惠金额</div>
                <!-- 接口没有该字段 -->
                <div>0.00</div>
            </div>
            <div class="h-12"></div> 

            <div class="item-view">
                <div>付款人</div>
                <div>{{ wareModal.MemberName }}</div>
            </div>
            <div class="h-12"></div> 
            <div class="h-20"></div>

            <div class="solid-line" ></div> 
            <div class="h-12"></div> 
            <div class="item-end-line">
                <text style="font-size: 12px;color: #999999;">已优惠</text>
                <!-- 接口没有该字段 -->
                <text style="font-size: 12px;color: #FF3333;">0.00</text>
                <text style="font-size: 12px;color: #999999;">元，支付金额：￥</text>
                <text style="font-size: 18px;color: #FFAA00;">{{wareModal.RealAmt}}</text>
            </div>
            <div class="h-60"></div> 
        </div>
        
    </page-wrap>
</template>

<script setup >
import Api from '@/api'
const route = useRoute()
const wareModal = ref({
    OrderTime: '',
    TotalAmt: '',
    RealAmt: '',
    MemberName: '',
});
const moreFlag = ref(false); 
const wareList = ref(); 
const initData = async function () {
    console.log("route.query.consumeCode", route.query.consumeCode);  
    let sendModal = { functionName: "MemberOrderInfoBefore", "contentData": { "consumeCode": route.query.consumeCode }}
    const resp = await Api.Common.AppObjProcess.Do(sendModal); 
    wareList.value =  resp.GoodsList
    wareModal.value = resp
    console.log("resp2",  wareList.value); 
};
onMounted(() => {
    initData()
}) 
</script>

<style scoped lang="scss">
.container {
    font-family: PingFang SC;
    font-weight: 500;
    font-size: 14px;
    color: #ffffff;

    .code-row {
        display: flex;
        justify-content: space-between;
        padding: 15px 13px;
        border-bottom: 1px solid #383840;
    }

    .ware-box {
        margin: 0 12px;
        padding: 12px 0;
        display: flex; 
        border-bottom: 1px solid #383840;

        .img-ware {
            width: 70px;
            height: 70px;
            margin-right: 12px;
            border-radius: 10px;
        }

        .ware-info-box {
            display: flex;
            flex-direction: column;
            justify-content: space-between;

            .title-row {
                display: flex;
                align-items: center;

                .ware-type {
                    width: 40px;
                    height: 22px;
                    border-radius: 2px;
                    font-family: PingFang SC;
                    font-weight: 500;
                    font-size: 12px;
                    line-height: 22px;
                    text-align: center;
                    margin-right: 6px;
                }

                .packge {
                    background: #343c3d;
                    color: #00d5ff;
                }

                .not-packge {
                    background: #343d3a;
                    color: #00ffaa;
                }

                .ware-title {
                    font-family: PingFang SC;
                    font-weight: 500;
                    font-size: 16px;
                    color: #ffffff;
                    width: 230px;
                }
            }

            .info {
                font-family: PingFang SC;
                font-weight: 500;
                font-size: 12px;
                color: #999999;
            }

            .price {
                font-family: PingFang SC;
                font-weight: 500;
                font-size: 18px;
                color: #cccccc;

                .price-no {
                    font-family: PingFang SC;
                    font-weight: 500;
                    font-size: 12px;
                    color: #cccccc;
                    text-decoration-line: line-through;
                    margin-left: 6px;
                }
            }
        }
    }

    .more-row {
        padding: 12px;
        font-family: PingFang SC;
        font-weight: 500;
        font-size: 13px;
        color: #ffaa00;
        text-align: center;
    }
}

.color-FFAA00 {
    color: #ffaa00;
}

.color-CCCCCC {
    color: #cccccc;
}

.foot-view{
    width: 349px;margin: 0 13px;color: #CCCCCC;font-size: 14px;
}
.dashed-line{
    height: 1px;border: 1px dashed #999999;width: 100%;
}
.solid-line{
    height: 1px;border: 1px solid #383840;width: 100%;
}
.h-12{
    height: 12px;
}
.h-20{
    height: 20px;
}
.h-60{
    height: 60px;
}
.item-view{
    height: 14px;line-height: 14px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;
}
.item-end-line{
    justify-content:end;
    align-items: baseline;
    height: 16px; 
    display: flex; 
    flex-direction: row;
}
</style>
